///////////////////////////////////////////////////////////////////////////////
// Includes
#include "main.h"
#include <krnlSystemTimer.h>
#include <drvServo.h>

extern void krnlSystemInitialization(void);

int main(void)
{
	// Initialize modules and CPU
	krnlSystemInitialization();
  
  /* Initialize Leds mounted on STM32F3-discovery */
  STM_EVAL_LEDInit(LED3);
  STM_EVAL_LEDInit(LED4);
  STM_EVAL_LEDInit(LED5);
  STM_EVAL_LEDInit(LED6);
  STM_EVAL_LEDInit(LED7);
  STM_EVAL_LEDInit(LED8);
  STM_EVAL_LEDInit(LED9);
  STM_EVAL_LEDInit(LED10);

  while (1)
  {
    /* Toggle LED3 */
    STM_EVAL_LEDToggle(LED3);
    /* Toggle LED7 */

    krnlDelay(1000);
  }


  
#if 0
  /* Turn On LED3 */
  STM_EVAL_LEDOn(LED3);
  /* Turn On LED7 */
  STM_EVAL_LEDOn(LED7);
  /* Turn On LED6 */
  STM_EVAL_LEDOn(LED6);
  /* Turn On LED10 */
  STM_EVAL_LEDOn(LED10);

  while (1)
  {
    /* Toggle LED3 */
    STM_EVAL_LEDToggle(LED3);
    /* Toggle LED7 */
    STM_EVAL_LEDToggle(LED7);
    /* Toggle LED6 */
    STM_EVAL_LEDToggle(LED6);
    /* Toggle LED10 */
    STM_EVAL_LEDToggle(LED10);
    
    /* Insert 100 ms delay */
    krnlDelay(100);
    
    /* Toggle LED4 */
    STM_EVAL_LEDToggle(LED4);
    /* Toggle LED5 */
    STM_EVAL_LEDToggle(LED5);
    /* Toggle LED9 */
    STM_EVAL_LEDToggle(LED9);
    /* Toggle LED8 */
    STM_EVAL_LEDToggle(LED8);
    
    /* Insert 150 ms delay */
    krnlDelay(150);
  }
#endif
}
